import type { CodeType, User, UserInfo } from "@/types/user";
import { request } from "@/utils/request";

// 密码登录
export const loginByPassword = (mobile : string , password : string) =>
  request<User>('/login/password' , 'POST' , { mobile , password })

// 获取验证码
// login登录register注册changeMobile更换手机号forgetPassword找回密码,bindMobile绑定三方登录，区分验证码
export const sendMobileCode = (mobile : string , type : CodeType) => {
  request('/code' , 'GET',{ mobile , type })
}

// 短信登录
export const loginByMobile = ( mobile : string , code : string ) => {
  request<User>('/login' , 'POST' , { mobile , code })
}

// 获取用户信息
export const getUserInfo = () => request<UserInfo>('/patient/myUser')

// 获取用户患者信息列表
export const getPatientList = () => request<PatientList>('/patient/mylist')
